﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.WindowsAzure.StorageClient;

namespace Microsoft.WindowsAzure.Search
{
    public class DocInfoWriter
    {
        public static void Write(Dictionary<int, String> docMap, Dictionary<int, int> docLength, CloudBlobContainer indexContainer)
        {
            String docInfo = "";
            docInfo += docMap.Keys.Count;

            foreach (KeyValuePair<int, String> pair in docMap)
            {
                docInfo = docInfo + "\n" + pair.Key + "," + docLength[pair.Key] + "," + pair.Value;
            }

            CloudBlob docInfoBlob = indexContainer.GetBlobReference("docInfo");
            docInfoBlob.UploadText(docInfo);
        }
    }
}